﻿using System.Collections.Generic;
using System.Data.Common;

namespace Avin.Infrastructure.Linq.ToDbScript
{
    public interface IToDbScript
    {
        /// <summary>
        /// 插入记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        string Insert<T>(T entity, string[] ignoreFields, List<DbParameter> parameters) where T : class;

        /// <summary>
        /// 更新记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        string Update<T>(T entity, string[] ignoreFields, List<DbParameter> parameters) where T : class;

        /// <summary>
        /// 更新记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <param name="updateFields"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        string Update2<T>(T entity, string[] updateFields, List<DbParameter> parameters) where T : class;

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        string Delete<T>() where T : class;

        /// <summary>
        /// 查询前几条记录
        /// </summary>
        /// <param name="queryInfo"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        string SelectTop(QueryInfo queryInfo, uint count);

        /// <summary>
        /// 提取查询记录
        /// </summary>
        /// <param name="queryInfo"></param>
        /// <param name="skip"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        string SelectTake(QueryInfo queryInfo);

        /// <summary>
        /// 查询所有记录
        /// </summary>
        /// <param name="queryInfo"></param>
        /// <returns></returns>
        string Select(QueryInfo queryInfo);

        /// <summary>
        /// 获取记录总数
        /// </summary>
        /// <param name="queryInfo"></param>
        /// <returns></returns>
        string Count(QueryInfo queryInfo);
    }
}
